home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 126-150 / disk_140 / sbprolog / readme < prev    next >
Text File  |  1992-05-06  |  11KB  |  263 lines

  1.  
  2.             STONY BROOK PROLOG (SBP)
  3.                 version 2.3.2
  4.           ported by David Roch and Scott Evernden
  5.             maintained by David Roch
  6.  
  7.  
  8. --- A Faery Tale :-) ---
  9.  
  10. Once upon a time, two programmers decided to port the same
  11. program.  After many hours of hacking, they both arrived
  12. at nearly the same result, a working Prolog system.  One
  13. of the programmers (the clever one), turned his work over
  14. to the other saying "Take this, and the headaches that go
  15. with it."  The other programmer naively accepted.  He
  16. discovered that the two programmers had both done similar
  17. work.  In some areas, one shone while the other was bogged
  18. down in the swamps of incomprehension and ignorance.  In
  19. other areas, the reverse was true.  Eventually, after many
  20. aeons, a unified version was complete, and they all lived
  21. happily ever after --- at least until the bug reports
  22. started pouring in.
  23.  
  24.  
  25. --- A short note on the SBP 2.3.2 port ---
  26.  
  27. When Scott sent me his version of 2.2, he had added some
  28. nice features to it which I have been unable to include
  29. in 2.3.2.  I did not include these modifictations for
  30. two reasons.  First, 2.3.2 is the second update to SBP
  31. in less than a year.  Conversations with S.K. Debray
  32. (the maintainer) lead me to believe that there will be
  33. future upgrades.  It is my intention to keep porting newer
  34. versions as simple as possible.  Secondly, and more importantly
  35. (to me at least), my purpose in porting SBP was to use it
  36. for work I'm doing on my thesis.  I do not have enough time
  37. to maintain additions which are irrelevant to my current work.
  38.  
  39.     Major omissions from Scott's version -
  40.         Manx C support - sorry, I don't have Manx
  41.         Library support - ability to call Amiga library routines
  42.  
  43. Nearly all the documentation is by Scott.  His
  44. documentation was much cleaner than mine, and I have
  45. merely edited his documentation where it was inconsistent
  46. with the merged version of the port.  Credit where credit's
  47. due.  Also, any gripes about style (or compliments) should
  48. be directed to me.  The additional code in the port is mine, 
  49. I merely used some of Scott's ideas.
  50.  
  51. From the SB-Prolog System, Version 2.2 User Manual:
  52.  
  53. "SB-Prolog is a public-domain Prolog system for Unix(tm) based systems
  54. originally developed at SUNY, Stony Brook.  The core of the system is an
  55. emulator, written in C for portability, of a Prolog virtual machine that is
  56. an extension of the Warren Abstract Machine.  The remainder of the system,
  57. including the translator from Prolog to the virtual machine instructions,
  58. is written in Prolog."
  59.  
  60. In addition to providing a compiler, SB-Prolog also offers advanced features
  61. such as dynamic loading, mixing of compiled and interpreted code, macros,
  62. extension tables, a debugging facility offering two levels of tracing,
  63. profiling tools, and other utilities.
  64.  
  65. Introduction
  66. ------------
  67. This is version 2.3.2 of SB-Prolog, originating from SUNY at Stony Brook.  It
  68. provides an advanced logic programming environment on the Amiga, adequate
  69. for experimentation in the areas of artificial intelligence and fifth
  70. generation systems.
  71.  
  72. When running the naive-reverse benchmark, the SB-Prolog interpreter runs at
  73. over 1000 LIPS (logical interences per second).  The compiler can produce
  74. code that can be executed at over 3600 LIPS.
  75.  
  76. The complete Amiga SB-Prolog distribution is provided on 2 disks.  The
  77. source code in C and Prolog is on the "PROLOG SOURCE:" disk;  executables
  78. and ready-to-load Prolog objects are on the "PROLOG:" disk.  The source
  79. disk is necessary only if you want to modify or add-to the operation of
  80. the system, or if you want to understand how a Prolog-based
  81. interpreter/compiler works.  Substantial portions of SB-Prolog, including
  82. its compiler, are written in Prolog.
  83.  
  84. Starting SB-Prolog
  85. ------------------
  86. A simple script on the SBP2.3.2: disk has been provided.  It runs SB-Prolog
  87. with a set of default configuration parameters which should be adequate for
  88. most medium sized tasks.  It can be 'Executed' to start SB-Prolog in this
  89. default configuration.  From the CLI:
  90.  
  91.     > execute prolog:prolog
  92.  
  93. WARNING:  If you have a shell running, this may not work!  SBP uses
  94. some characters e.g. $,! that are frequently used by shells as 
  95. control characters.  If you have problems, try it without the shell.
  96. (You should probably start a new cli anyway, the shell is useless
  97. while SBP is running).
  98.  
  99. This will be followed by 30 seconds of much disk activity as the byte codes
  100. for the interpreter are read from disk.  The a silent 20 second pause ensues
  101. as the interpreter program adjusts itself to the impressive greatness of
  102. the Amiga.  Finally, a message is printed, and SB-Prolog is running. I run
  103. my system with 50000 bytes of Stack, and have never had problems with this
  104. setting.
  105.  
  106. To quickly test the operation of the system, you can do the following, and
  107. observe the results:
  108.  
  109.     | ?- consult('hanoi.P').
  110.     | ?- hanoi(5, start, aux, end, Solution).
  111.  
  112. These statements demonstrates the performance of interpreted SB-Prolog while
  113. solving the Towers of Hanoi problem.
  114.  
  115.     | ?- compile('hanoi.P','hanoi').
  116.     | ?- load('hanoi').
  117.     | ?- hanoi(5, start, aux, end, Solution).
  118.  
  119. Here we compile (takes about a minute), load, and then execute the
  120. Towers of Hanoi program.
  121.  
  122. SBP supports break levels which are described in the documentation.
  123. However, I'll point them out now in case you decide to do something
  124. naive like hanoi(5000, s, a, e, S) which takes a long, long, long
  125. time.  You can type ^C (Ctrl-C) during execution, and SBP will
  126. suspend the current computation.  At the break level, you are
  127. permitted to do anything normally permissible.  If you wish
  128. to continue the suspended computation, you may do so by typing
  129. ^\ (end of file), or typing "abort." to abort the computation.
  130.  
  131. In SBP, you are not allowed to input predicates at the command
  132. line level.  You can only consult existing files.  Once you begin
  133. to feel comfortable with the system, you could define your own
  134. input routine that asserts each fact as it is read in.  However,
  135. assuming that you have enough memory to run an editor, this should
  136. not pose any problem.  
  137.  
  138. You can access AmigaDOS; for example:
  139.  
  140.     | ?- system(list).
  141. or
  142.     | ?- system('list df1:').
  143.         note the single quotes.
  144.  
  145. And finally, since you'll probably want to stop the program sometime:
  146.  
  147.     | ?- halt.
  148. or
  149.     | ?- end_of_file.
  150. or
  151.     | ?- ^\     (control \ is the end of file character on the Amiga)
  152. will return you to the CLI.
  153.  
  154.  
  155. The complete syntax for running SB-Prolog directly, describing all
  156. configuration parameters is detailed in the User Manual.  Briefly,
  157. the command line:
  158.  
  159. SBP2.3.2:sbp/sim -i ".!sbplibs:modlib!sbplibs:lib!sbplibs:cmplib" -m 
  160.     75000 -p 75000 SBP2.3.2:sbp/libraries/modlib/$readloop
  161.  
  162. means run SB-Prolog with 75K longwords of heap/stack (-m switch);
  163. with 75K longwords of permanent space (-p switch), and provides
  164. a path to the libraries (-i switch).  The last argument tells 
  165. the byte code simulator (SBP) to load and execute the query evaluator
  166. (user interface) $readloop.
  167.  
  168.  
  169. IMPORTANT:
  170. This program will not have available enough memory to operate on a 512K or
  171. less Amiga.  It probably won't run on a one megabyte machine either
  172. unless you decrease the default heap and memory space.  No guarantees
  173. though, I haven't tried it.
  174.  
  175. The system is quite memory-intensive, requiring approximately 92K bytes for
  176. the SB-Prolog 'simulator', and 2 contiguous 300K byte blocks of memory for
  177. SB-Prolog's heap/stack, and permanent memory space.  You really will need
  178. more than 1Meg to effectively use the program.  I find myself running out
  179. of memory on my 2.5Meg setup!  If you see the "Not enought core!" message,
  180. rebooting your Amiga will consolidate fragmented memory, and may allow the
  181. program the elbow room it needs to run.
  182.  
  183.  
  184. Documentation
  185. -------------
  186. The User Manual for SBP is SBProlog.doc and is located on this disk.
  187. Scott has gone to the trouble of formatting it nicely.  Note that
  188. the manual is for 2.2, not 2.3.2.  This is as the changes for 2.3.2
  189. have nearly all been internal to the libraries and the simulator.
  190. The only new feature is that files may be consulted with list notation.
  191. That is, instead of typing 'consult(filename).' the user may type
  192. '[filename]' as in some other Prolog implementations.
  193.  
  194. The original documentation (Troff/Nroff format) is available on
  195. the archives disk for those who have access to UNIX (TM AT&T)
  196. systems.  Scott used the following to sequence to produce his
  197. copy:    cat sbprolog_doc.me | tbl | neqn | nroff -Me.
  198.  
  199. Differences from the UNIX version
  200. ---------------------------------
  201.  The Amiga OS does not yet support environment variables, so I
  202. needed to devise an alternate mechanism for this capability.  So, a new
  203. switch (-i) has been added to pass the SIMPATH variable.  What SIMPATH
  204. does for SBP is to tell the simulator where to find the programs
  205. to be loaded.  This is very similar to the PATH variable in UNIX.
  206. For example:
  207.     -i .!SBPLIBS:lib!SBPLIBS:modlib!SBPLIBS:cmplib
  208. tells the simulator to look first in the current directory (the '.'),
  209. then in directory SBPLIBS:lib, and so on down the path for each
  210. program that it needs to load.  Spaces are not allowed.  Note
  211. that when the -i option is specified, any calls to the $getenv/2
  212. primitive will return the path you specified via -i.  Currently,
  213. the SIMPATH is limited to 256 characters (you can easily change
  214. this if you have a C compiler).  No error will be given
  215. should you exceed this.  
  216.  
  217. The system predicate syscall/3 has only three UNIX system calls
  218. implemented:  chdir, chmod, and access.  Chdir can be extremely
  219. useful to the user as it provides a method of changing directories
  220. within SBP.  To use it, type the following:
  221.     syscall(12, ['df1:some/directory/path'], Result).
  222. If Result = 0, then the change was successful.  You may find it
  223. useful to define the following in your files:
  224.     cd(Dir) :- syscall(12, [Dir], X), X =:= 0.
  225. then you can merely cd('directory/path').  The predicate will
  226. fail if you specify an illegal directory.
  227.  
  228.  
  229. Archive Disk:
  230. -------------
  231. The other disk that comes with this distribution is the archive
  232. disk.  It contains C source code for the simulator (along with
  233. a description in file changes of the changes I made), the
  234. Prolog source code for the libraries, and benchmark programs.
  235. These are all stored in the zoo archive format.  A copy of zoo
  236. is also supplied so that you can unarchive them.
  237.  
  238. KNOWN BUGS:
  239. -----------
  240.     - The restore command will not work across seperate
  241.     invocations of the simulator.  I believe that I have
  242.     found the source of the problem, but I haven't had
  243.     time to fix it.
  244.     
  245.     - When requesting a break level, if the system is
  246.     requesting input, you must type some character after
  247.     ^C and press Return.  I usually use the comment 
  248.     character % to avoid having SBP interpret this as
  249.     a command when I return from the break level.
  250.  
  251.     - Timing statistics are frequently blatantly wrong.
  252.     For example, the compiler may tell you that it only
  253.     took 30 seconds to compile when in fact, it took over
  254.     a minute.
  255.  
  256.     - Sometimes after consulting a file numerous times
  257.     (e.g. during devlopment), the changes will not take
  258.     effect.  This is a problem with SBP, not the port.
  259.     I have so far been unable to come up with a consistent
  260.     case to demonstrate this bug.  If anyone does, please
  261.     send it to me and I'll see what can be done about it.
  262.     In the mean time, you can exit SBP and restart.
  263.